/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package updater;

import com.sun.java.swing.plaf.windows.WindowsBorders.ProgressBarBorder;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.MediaTracker;
import java.awt.Toolkit;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JProgressBar;

/**
 *
 * @author rbs
 */
public class StartFrame extends JFrame{

    public JProgressBar progress;

    public StartFrame() {
        setUndecorated(true);
        setSize(640, 480);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

        setContentPane(new BackGroundPane("start_bg.jpg"));

        progress = new JProgressBar();
        add(progress);

        setVisible(true);

        progress.setLocation(0, 400);
        progress.setSize(640, 3);
        progress.setBorderPainted(false);
        progress.setBackground(Color.BLACK);
        progress.setForeground(Color.GREEN);
    }
    public void SetProgress(int val)
    {
        progress.setValue(val);
    }

}


class BackGroundPane extends JPanel {
        Image img = null;

        BackGroundPane(String imagefile) {
            if (imagefile != null) {
                MediaTracker mt = new MediaTracker(this);
                img = Toolkit.getDefaultToolkit().getImage(imagefile);
                mt.addImage(img, 0);
                try {
                    mt.waitForAll();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }

        protected void paintComponent(Graphics g) {
            super.paintComponent(g);
            g.drawImage(img,0,0,this.getWidth(),this.getHeight(),this);
        }
    }

